"""
基于进程 multiprocessing.Process 的策略模板

"""
import multiprocessing
from typing import Any,Callable

class MPStra(multiprocessing.Process):
    params = dict()
    variables = dict()

    def __init__(self, ree, conf: dict = None):
        multiprocessing.Process.__init__(self)
        # redis event engine
        self.ree = ree 
        if conf:
            for k, v in conf.items():
                self.__dict__[k] = v

    def init(self):
        '''初始化时调用'''
        pass

    def on_tick(self, tick):
        pass

    def on_bar(self, bar):
        pass

    def on_data(self,data):
        pass

    def run(self) -> None:
        self.init()

        while True:
            # 策略在此实现
            pass


class StraBase():
    """
    """
    def __init__(self, straConf:dict=None) -> None:
        self.on_data:callable=None

    def start(self):
        pass

    def onTick(self,tick):
        pass

    def onBar(self,bar):
        pass

    def onTicks(self,ticks):
        pass

    def onBars(self,bars):
        pass


    def stop(self):
        pass